//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __OSDEPEND__
#define __OSDEPEND__

extern void ppcc(const char *fmt, ...);

#ifdef _zener
inline void *ComChannelMalloc(int size)
{
    return malloc(size);
}

#define MALLOC(size) ComChannelMalloc(size)
#define REALLOC realloc
#define FREE free
#define COMMU_PRINTF ppcc

#else

#define MALLOC(size) malloc(size)
#define REALLOC realloc
#define FREE free
#define COMMU_PRINTF ppcc

#endif

typedef C_INT (*THREADFUNC)(C_PVOID arg);

extern C_LOCK InitLock();
extern C_VOID Lock(C_LOCK lock);
extern C_VOID UnLock(C_LOCK lock);
extern C_VOID DeleLock(C_LOCK lock);
extern C_EVENT EventCreate(C_BOOL bManualReset);
extern C_BOOL EventSet(C_EVENT event);
extern C_BOOL EventReset(C_EVENT event);
extern C_INT WaitForEvent(C_EVENT event, C_LONG timeout);
extern C_VOID DeleEvent(C_EVENT event);
extern C_INT CreateChannelThread(THREADFUNC func, C_PVOID arg, C_PVOID* ppThreadHandle);
extern C_INT TerminateChannelThread(C_PVOID pThreadHandle);

#endif //__OSDEPEND__
